var zstx = {
    //增
    insert: 'INSERT INTO `admin` (`id`,`name`,`desc`,`price`,`sum`) VALUES(0,?,?,?,?)',
    //删
    delete: 'delete from admin where id=?',
    //改
    update: function ({name, id}) {
        return `UPDATE admin SET name=${name} WHERE id=${id}`
    },
    //查
    getAdminList: function (offset) {
        return `select * from admin limit ${offset}, ${offset + 20}`
    },

    getContentList: function (type, offset) {
        return `select id,title,imgUrl,type,originaldate from ContentList 
        where type=${type} limit ${offset},${offset + 20}`
    },

    findById: function (adminId) {
        return `select * from admin where admin_id=${adminId}`
    },

    adminCount: 'select count(*) as count from admin',

    contentCont: 'select ',

    myTask: function (type, state, id) {
        return `SELECT sql_calc_found_rows id,title,imgUrl,aId,atime,originaldate,confidence from ContentList where state=1 and aid=1 and type='故事读物';`
    },

    myTaskCount: function (type, state, id) {
        return `SELECT count(*) as count from ContentList where state=1 and aid=1 and type='故事读物';`
    },

    myTaskPub: function (type, state, id) {
        return `select count(*) from ContentList where type=${type} state=${state} and aid=${id}`
    },

    myTaskPubCount: function (type, state, id) {
        return `select count(*) from ContentList where type=${type} state=${state} and aid=${id}`
    },

    rePubsh: function (id) {
        return `update ContentList set state=1 where id=${id}`
    },

    checkContent: function (c) {
        return `update ContentList 
        set title=${c.title}, type=${c.type}, content=${c.content}, imgUrl=${c.imgUrl}, 
        where id=${c.id}`
    }
}

module.exports = zstx;